﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using XWord.Fundamental.Domain.Model;
using XWord.Fundamental.Domain;
using Microsoft.Practices.ServiceLocation;
using Caliburn.PresentationFramework.ApplicationModel;
using Caliburn.Core.Metadata;
using XWord.WPF.ApplicationFramework;
using XWord.Common;

namespace XWord.GUI.Presenters
{
    [Singleton(typeof(LCArticlePresenter))]
    public class LCArticlePresenter : Presenter
    {
        public LCArticlePresenter()
        {
            LCArticleList = BinaryFormatterHelper.Deserialize<IList<LCArticle>>(BinaryFiles.LCArticleList);
        }

        public IList<LCArticle> LCArticleList { get; set; }

        public void OpenArticleDetailViewDialog(LCArticle entity)
        {
            var presenter = ServiceLocator.Current.GetInstance<LCArticleDetailPresenter>();
            presenter.Detail = entity;
            ServiceLocator.Current.GetInstance<IWindowManager>()
                .Show(presenter, null, ExecuteShutdownModel);
        }
    }
}
